package com.example.cofeed.activity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;

import  com.example.cofeed.util.ToastUtils;;
import com.example.cofeed.R;
import com.example.cofeed.api.ApiService;
import com.example.cofeed.base.BaseActivity;
import com.example.cofeed.callback.DialogCallback;
import com.example.cofeed.callback.LzyResponse;
import com.example.cofeed.constant.IntentKeyConstant;
import com.lzy.okgo.model.Response;
import com.umeng.analytics.MobclickAgent;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by mqwang on 2017/9/24.
 */

public class ErrorCorrectionActivity extends BaseActivity {
    @BindView(R.id.content_et)
    EditText contentEt;
    private String msgId;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_error_correction;
    }

    @Override
    protected void init(Bundle savedInstanceState, View container) {
        setMainTitle("纠错");

        msgId = getIntent().getStringExtra(IntentKeyConstant.MSG_ID);

    }

    @OnClick(R.id.confirm_tv)
    public void onViewClicked() {
        String content = contentEt.getText().toString();
        if (TextUtils.isEmpty(content)){
            ToastUtils.showShort("请输入文字");
            return;
        }

        ApiService.smsCorrect(this, msgId, content, new DialogCallback<LzyResponse<Object>>(this) {
            @Override
            public void onSuccess(Response<LzyResponse<Object>> response) {
                showToast(response.body().message);
                finish();

            }
        });

    }

    @Override
    public void onResume() {
        super.onResume();
        MobclickAgent.onResume(this);
    }

    @Override
    public void onPause() {
        super.onPause();
        MobclickAgent.onPause(this);
    }

}
